package com.centaline.androidsalesblog.widgets;

import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.View;

/**
 * Created by guilin on 16/6/2.
 * <p/>
 * 描述:
 */
public class CubeFlipTransformer implements ViewPager.PageTransformer {

    @Override
    public void transformPage(View page, float position) {
        Log.d("tag", "position : " + position);
        page.setRotationX(0);
        page.setRotation(0);
        page.setScaleX(1);
        page.setScaleY(1);
        page.setTranslationY(0);
        page.setTranslationX(0);

        page.setAlpha(position <= -0.5f || position >= 0.5f ? 0f : 1f);
        page.setEnabled(false);

        page.setPivotX(position < 0f ? page.getWidth() : 0f);
        page.setPivotY(page.getHeight() * 0.5f);

        page.setRotationY(180f * position);
    }
}
